package HashMap;

/**
 * Created by wangyg 
 * on 2017/6/13 9:37
 */
public class Test {
	public static void main(String[] args) {
		int num=-13;
		System.out.println(num%2);
		System.out.println(Math.floorMod(num,2));





		int capacity=16;
		int n = capacity - 1;
		n |= n >>> 1;
		System.out.println(n);
		n |= n >>> 2;
		System.out.println(n);
		n |= n >>> 4;
		System.out.println(n);
		n |= n >>> 8;
		System.out.println(n);
		n |= n >>> 16;
		System.out.println(n);
		n=(n < 0) ? 1 : (n >= 1 << 30) ? 1 << 30 : n + 1;
		System.out.println(n);


		int m=6;
		m=m>9?m:m<5?5:m;
		System.out.println(m);
		System.out.println(1<<30);
		System.out.println(16>>>16);
		System.out.println(Integer.toBinaryString(7));
		System.out.println(7<<1);
		System.out.println(7>>1);
		System.out.println("------------");


		int number = 7;
		//原始数二进制
		printInfo(number);

		number = number >> 1;
		//右移一位
		System.out.println(number);
		printInfo(number);

		number = number << 1;
		//左移一位
		System.out.println(number);
		printInfo(number);

	}

	/**
	 * 输出一个int的二进制数
	 * @param num
	 */
	private static void printInfo(int num){
		System.out.println(Integer.toBinaryString(num));
	}




}
